package com.zch.starter.metrics.prometheus.springboot.starter.instance.actuator;

import org.springframework.boot.actuate.autoconfigure.system.DiskSpaceHealthIndicatorProperties;
import org.springframework.boot.actuate.system.DiskSpaceHealthIndicator;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.File;

public class SystemMonitoringConfig {


    // 磁盘信息
    @Bean
    @ConditionalOnMissingBean
    public DiskSpaceHealthIndicator diskSpaceHealthIndicator(DiskSpaceHealthIndicatorProperties properties) {
        return new DiskSpaceHealthIndicator(new File("."), properties.getThreshold());
    }

}
